package lab01;

/**
 * Created by lady on 2017/10/12.
 */
public class Test05 {

    public static void main(String[] args) {
        int i=1, n = 10, sum1 = 0, sum2 = 0, sum3 = 0;
        for (i = 1; i <= n; i++) {
            sum1 = sum1 + i;
        }
        System.out.println(sum1 );
                                  //for循环
        while (i <= n) {
            sum2 = i + sum2;
            i++;
        }
        System.out.println(sum2 );
                                 //while循环
        do {
            sum3 = sum3 + i;
            i++;
        } while (i <= n);
        System.out.println(sum3 );
                                 //do...while循环求和
    }

}
